package cn.good.solr.controller;


import cn.good.dto.Dto;
import cn.good.dto.DtoUtil;
import cn.good.solr.service.DoctorSolrService;
import cn.good.solr.vo.DoctorSolrVO;
import cn.good.solr.vo.FindSolrVO;
import cn.good.utils.Constant;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Controller
@RequestMapping("/doc/doctorSolr")
public class DoctorSolrController {

    @Resource
    private DoctorSolrService doctorSolrService;

    @ApiOperation(value="查询医生列表",httpMethod = "POST",
            protocols = "HTTP", produces = "application/json",
            response = Dto.class,notes="查询医生列表"+
            "<p>错误码：</p>"+
            "<p>20000：获取医生列表失败</p>")
    @RequestMapping(value = "/doctorList",produces = "application/json",method = RequestMethod.POST)
    @ResponseBody
    public Dto<DoctorSolrVO> doctorList(FindSolrVO vo){
        DoctorSolrVO doctorSolrVO=null;
        try {
            doctorSolrVO=doctorSolrService.searchDoctorListPage(vo);
            return DtoUtil.returnDataSuccess(doctorSolrVO);
        } catch (Exception e) {
            e.printStackTrace();
            return DtoUtil.returnFail("获取信息失败","20000");
        }
    }


}
